package com.cskaoyan.controller.lz_controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.Order;
import com.cskaoyan.bean.lzpackage.lz_order.OrderData;
import com.cskaoyan.mapper.ElseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("admin/config")
public class AdminOrderController {
    @Autowired
    ElseMapper elseMapper;
    @GetMapping("order")
    public BaseRespVo list() {
        String comment= elseMapper.selectOrder("market_order_comment");
        String unconfirm= elseMapper.selectOrder("market_order_unconfirm");
        String unpaid= elseMapper.selectOrder("market_order_unpaid");
        OrderData order=new OrderData();
        order.setMarket_order_comment(comment);
        order.setMarket_order_unconfirm(unconfirm);
        order.setMarket_order_unpaid(unpaid);
        return BaseRespVo.ok(order);
    }
    @PostMapping("order")
    public BaseRespVo list1(@RequestBody OrderData order) {
        elseMapper.updateOrder("market_order_comment",order.getMarket_order_comment());
        elseMapper.updateOrder("market_order_unconfirm",order.getMarket_order_unconfirm());
        elseMapper.updateOrder("market_order_unpaid",order.getMarket_order_unpaid());
        return BaseRespVo.out();
    }
}
